package com.SMP.service;

import com.SMP.dao.AppVersionMapper;
import com.SMP.dao.NewsMapper;
import com.SMP.model.AppVersion;
import com.SMP.model.AppVersionExample;
import com.SMP.model.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: SchoolManagementPlatform
 * @description: 移动端服务
 * @author: WYHY
 * @create: 2018-12-25 13:41
 **/
@Service
public class ApiService {

    @Autowired
    AppVersionMapper appVersionMapper;

    @Autowired
    NewsMapper newsMapper;

    /** 
    * @Description: 查询APP版本号
    * @Param: [] 
    * @return: com.SMP.model.AppVersion 
    * @Author: WYHY 
    * @Date: 2018/12/25 
    */
    public AppVersion selAppVerson(){
        AppVersionExample example=new AppVersionExample();
        example.setOrderByClause("versopn_code DESC limit 1");
        AppVersionExample.Criteria criteria=example.createCriteria();
        AppVersion result=appVersionMapper.selectByExample(example).get(0);
        return result;
    }

    /**
    * @Description: 查询新闻时间与条数
    * @Param: []
    * @return: java.util.List<com.SMP.model.News>
    * @Author: WYHY
    * @Date: 2018/12/25
    */
    public List<News> selNewsTime(){
        List<News> result=newsMapper.selectByNewsTime();
        return result;
    }

}
